﻿@model ExcellOnServices.Models.Product

@{
    ViewBag.Title = "Create";
    Layout = "~/Areas/DashBoard/Views/Shared/_Layout.cshtml";
}

<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">Add Product</h3>
    </div>
    @using (Html.BeginForm("Create", "Products", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        <div class="panel-body">
            @Html.AntiForgeryToken()
            <div class="form-horizontal">                
                <div class="form-group">
                    @Html.LabelFor(model => model.Name, "Name", new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(model => model.Name, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.Name)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Price, "Price ($)", new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(model => model.Price, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.Price)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Discount, "Discount ($)", new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(model => model.Discount, new { @class = "form-control", @Value = "0" })
                        @Html.ValidationMessageFor(model => model.Discount)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Description, new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.TextAreaFor(model => model.Description, new { @class = "form-control mceEditor", @style = "resize:vertical;", @rows = "8" })
                        @Html.ValidationMessageFor(model => model.Description)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.ImageUrl, "Image", new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.TextBoxFor(model => model.ImageUrl, new { @type = "file" })
                        @Html.ValidationMessageFor(model => model.ImageUrl)
                    </div>
                </div>

                <div class="form-group">
                    @Html.LabelFor(model => model.Category_Id, "Category", new { @class = "control-label col-md-2" })
                    <div class="col-md-10">
                        @Html.DropDownList("Category_Id", (IEnumerable<SelectListItem>)ViewBag.CatId, new { @class = "form-control" })
                        @Html.ValidationMessageFor(model => model.Category_Id)
                    </div>
                </div>
            </div>
        </div>
        @Html.ValidationSummary(true)
        <div class="panel-footer">
            <input type="submit" value="Create" class="btn btn-primary" />
            @Html.ActionLink("Back to List", "Index", null, new { @class = "btn btn-primary btn-sm" })
        </div>
    }
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
